{extend name="public/base" /} {block name="body"}
<div class="ibox float-e-margins">
	<div class="content-tabs">
		<ol class="breadcrumb">
			<li>
				<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
			</li>
			<li><strong>销量统计</strong></li>
		</ol>
	</div>
	<div class="ibox-title">
		<ul class="nav nav-tabs">
			<li id="li-bar-grab0" >
				<a href="{:url('sales_enter/index')}?isline=0">线上销量</a>
			</li>
			<li id="li-bar-grab1">
				<a href="{:url('sales_enter/index')}?isline=1">线下销量</a>
			</li>
		</ul>
	</div>
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('index')}">
			<div class="order-info panel panel-default">
				<div class="panel-heading">
					<strong><i class="fa fa-bar-chart" style="color:#f70;"></i>&nbsp;&nbsp;各栏目周销量统计</strong>&nbsp;&nbsp;
				</div>
				
				<div class="panel-body clearfix">
					{if  $isline==0  }
					<div class="info-group">
						<span class="h4">
							{$ysum}
						</span>
						<span class="info-description">优惠购销量</span>
					</div>
					<div class="info-group">
						<span class="h4">
							{$fsum}
						</span>
						<span class="info-description">疯狂抢销量</span>
					</div>
					<div class="info-group">
						<span class="h4">
							{$zsum}
						</span>
						<span class="info-description">赚积分销量</span>
					</div>
					<div class="info-group">
						<span class="h4">
							{$psum}
						</span>
						<span class="info-description">云拼团销量</span>
					</div>
					{else}
					<div class="info-group" >
						<span class="h4" >
							{$linesum}
						</span>
						<span class="info-description">线下一周销量</span>
					</div>
					{/if}
				</div>
				
				
			</div>
			<!--统计图-->
			<div id="main" style="width: 100%;height:400px;"></div>
		</form>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__JS__/echarts.common.min.js"></script>
<style>
	
	.order-info .info-group {
		width: 25%;
		text-align: center;
		float: left;
	}
	
	.order-info .info-group+.info-group {
		border-left: 1px dotted #ccc;
	}
	
	.h4 {
		font-size: 22px;
		display: block;
	}
</style>
<script>
	var isline = {$isline};
	//顶部导航
	if(isline == '0'){
		$("#li-bar-grab0").addClass("active");
	}else{
		$("#li-bar-grab1").addClass("active");
	}
	var myChart = echarts.init(document.getElementById('main'));
	//获取当前时间
	var moth = [];
	var time = new Array();
	var time = '<?php echo json_encode($day);?>';
	var aarr = eval(time);

	for(var i = 0; i < 7; i++) {
		moth[i] = aarr[i];
		moth.sort();
	}
{if  $isline==0  }
	var ysum = [{$ysums['6']}, {$ysums['5']}, {$ysums['4']}, {$ysums['3']}, {$ysums['2']}, {$ysums['1']}, {$ysums['0']}];
	var fsum = [{$fsums['6']}, {$fsums['5']}, {$fsums['4']}, {$fsums['3']}, {$fsums['2']}, {$fsums['1']}, {$fsums['0']}];
	var zsum = [{$zsums['6']}, {$zsums['5']}, {$zsums['4']}, {$zsums['3']}, {$zsums['2']}, {$zsums['1']}, {$zsums['0']}];
	var psum = [{$psums['6']}, {$psums['5']}, {$psums['4']}, {$psums['3']}, {$psums['2']}, {$psums['1']}, {$psums['0']}];
{else}
	var linesum = [{$linesums['6']}, {$linesums['5']}, {$linesums['4']}, {$linesums['3']}, {$linesums['2']}, {$linesums['1']}, {$linesums['0']}];
{/if}
	option = {
		title: {
			text: '各栏目销量统计'
		},
		tooltip: {
			trigger: 'axis'
		},
		legend: {
			data: ['优惠购', '疯狂抢', '赚积分', '云拼团','线下销量']
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},
		toolbox: {
			feature: {
				saveAsImage: {}
			}
		},
		xAxis: {
			type: 'category',
			boundaryGap: false,
			data: moth
		},
		yAxis: {
			type: 'value'
		},
		series: [
		{if  $isline==0  }
			{
				name: '优惠购',
				type: 'line',
				stack: '总量',
				data: ysum

			},
			{
				name: '疯狂抢',
				type: 'line',
				stack: '总量',
				data: fsum
			},
			{
				name: '赚积分',
				type: 'line',
				stack: '总量',
				data: zsum
			},
			{
				name: '云拼团',
				type: 'line',
				stack: '总量',
				data: psum
			}
		{else}
			{
				name: '线下销量',
				type: 'line',
				stack: '总量',
				data: linesum
			}
			{/if}
		]
	};
	myChart.setOption(option);
</script>
{/block}